-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: convert CLI entry points to ESM; migrate create-docusaurus to ESM #6661
Conversation
864f1e2
to
d100813
Compare
✔️ [V2] 🔨 Explore the source changes: 307da2c 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/620d0df05fa7a70008c352b6 😎 Browse the preview: https://deploy-preview-6661--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6661--docusaurus-2.netlify.app/ |
Size Change: +1.24 kB (0%) Total Size: 780 kB
ℹ️ View Unchanged
|
@slorber Now here's a good question worth considering as we upgrade. Do you have strong opinions about using |
1da8025
to
af1fbf8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
export {default as clear} from './commands/clear'; | ||
export {default as writeTranslations} from './commands/writeTranslations'; | ||
export {default as writeHeadingIds} from './commands/writeHeadingIds'; | ||
import build from './commands/build'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really needed? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, because of some weird TS transpilation output... It's not as sane as exports.clear = require('./commands/clear').default
. Doesn't look much worse this way
no strong opinions on lodash to block this PR As long as it works and it's only in the nodejs side I don't think the impact is huge, but we should probably migrate to lodash-es someday, not necessarily today |
I actually have thought about using |
- update-notifier is only used by @docusaurus/core - update-notifier@6 is pure ESM (a breaking change) - docusaurus entry points are ESM (facebook/docusaurus#6661), so the package is still compatible
Motivation
#6520
This is a safe move, because CLI entry points aren't imported in any file.
For now, we are using
createRequire(import.meta.url)
to import the package.json files, but we may explore using JSON modules in the future.Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Tests